package com.panshi.utils;

import com.alibaba.fastjson.JSONObject;
import com.panshi.api.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.util.HashMap;

/**
 * @author :jiege
 * @description :
 * @create :2020-08-03 14:47:00
 */
@Component
public class EmailPhoneUtill {

    @Autowired
    private JavaMailSenderImpl JavaMailSenderImpl;

    @Value("${spring.mail.username}")
    private String myemail;

    //发送邮件审核通过表发送邮箱提示
    public void setemailarticle(String email,String title) throws MessagingException {
        //一个复杂的邮件
        MimeMessage mimeMessage=JavaMailSenderImpl.createMimeMessage();
        //组装
        MimeMessageHelper helper=new MimeMessageHelper(mimeMessage,true);
        helper.setSubject("渣男团的有贝口腔");
        helper.setText(title,true);//true支持html
        helper.setTo(email);
        helper.setFrom(myemail);
        JavaMailSenderImpl.send(mimeMessage);
    }
}
